import os
import json
from conf.settings import CUSTOMERS_JSON_PATH
from loguru import logger

def loads_customers_json():
    customers = {}
    print("11111")
    if os.path.exists(CUSTOMERS_JSON_PATH):
        with open(CUSTOMERS_JSON_PATH, "r", encoding="utf-8") as f:
            customers = json.load(f)
        logger.info(f"{CUSTOMERS_JSON_PATH}加载成功！")
    print(customers)
    return customers

def save_customers(customers):
    with open(CUSTOMERS_JSON_PATH, "w", encoding="utf-8") as f:
        # json.dumps()
        json.dump(customers, f)